local skill = fk.CreateSkill {
  name = "#ling__jialing_tu_skill",
  attached_equip = "ling__jialing_tu",
  tags = { Skill.Compulsory },
}

skill:addEffect(fk.EventPhaseEnd, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skill.name) and player.phase == Player.Play
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    for i = 1, 3, 1 do
      if player.dead then return end
      local judge = {
        who = player,
        reason = skill.name,
        pattern = ".|.|spade,club",
      }
      room:judge(judge)
      if not player.dead and judge.card and judge.card.color == Card.Black then
        player:drawCards(1, skill.name)
      end
    end
  end,
})
return skill
